package com.mycompany.myapp.web.rest.controller;

    import com.mycompany.myapp.service.CommodityService;
    import com.mycompany.myapp.web.rest.utils.ResultObj;
    import io.swagger.annotations.Api;
    import io.swagger.annotations.ApiOperation;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.*;

@Api(tags = {"后台管理-商品管理"})
@RestController
@RequestMapping("/api")
public class MCommodityController {
    @Autowired
    private CommodityService commodityService;


    @ApiOperation("查询全部商品")
    @GetMapping("/mgoods/findAllByParams")
    private ResultObj findGoodsByParams(@RequestParam(value = "pagenum") int pageNum,
                                        @RequestParam(value = "pagesize") int pageSize,
                                        @RequestParam(value = "query") String username) {
        return commodityService.findGoodsByParams(pageNum, pageSize, username);
    }

    @ApiOperation("删除商品")
    @DeleteMapping("/mgoods/delete")
    public ResultObj deleteGoodsInfo(@RequestParam(value = "id") long id) {
        return commodityService.deleteGoodsInfo(id);
    }



}
